package com.belizer.demo.threadpool;

import java.util.ArrayList;
import java.util.List;

// fork-join
public class Demo4 {
    public static void main(String[] args) {
        //准备数据
        List<Integer> integerList = new ArrayList<>();
        for(int i = 1; i<=100; i++){
            integerList.add(i);
        }

        // Parallel Stream
        Integer sum = integerList.parallelStream().reduce(Integer::sum).get();
        System.out.println("sum->" + sum);
    }
}
